// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System;

namespace SnapObjects.Data
{
    public class DbColumnInfo
    {
        public DbColumnInfo(
            int columnOrdinal,
            string columnName,
            Type dataType,
            bool isPrimaryKey = false,
            bool isIdentity = false,
            bool isNullable = false)
            :this(columnOrdinal, 
                 columnName, 
                 dataType, 
                 isPrimaryKey, 
                 isIdentity, 
                 isNullable, 
                 false, 
                 null, 
                 null, 
                 false,
                 null,
                 0,
                 String.Empty,
                 false,
                 false,
                 0,
                 0,
                 false)
        {

        }

        public DbColumnInfo(
            int columnOrdinal,
            string columnName,
            Type dataType,
            bool isPrimaryKey,
            bool isIdentity,
            bool isNullable,
            bool isExpression,
            string tableSchema,
            string table,
            bool isTimestamp,
            string typeName,
            int columnSize,
            string baseColumnName,
            bool isReadOnly,
            bool isAliased,
            int numericPrecision,
            int numericScale,
            bool isUnique)
        {
            this.ColumnOrdinal = columnOrdinal;
            this.ColumnName = columnName;
            this.DataType = dataType;
            this.IsPrimaryKey = isPrimaryKey;
            this.IsIdentity = isIdentity;
            this.IsNullable = isNullable;
            this.IsExpression = isExpression;
            this.TableSchema = tableSchema;
            this.Table = table;
            this.IsTimestamp = isTimestamp;
            this.TypeName = typeName;
            this.ColumnSize = columnSize;
            this.BaseColumnName = baseColumnName;
            this.IsReadOnly = isReadOnly;
            this.IsAliased = isAliased;
            this.NumericPrecision = numericPrecision;
            this.NumericScale = numericScale;
            this.IsUnique = isUnique;
        }

        public int ColumnOrdinal { get; }
        public string ColumnName { get; }
        public Type DataType { get; }
        public bool IsPrimaryKey { get; internal set; }
        public bool IsIdentity { get; internal set; }
        public bool IsNullable { get; internal set; }
        public bool IsExpression { get; internal set; }
        public string Table { get; }
        public string TableSchema { get; internal set; }
        public bool IsTimestamp { get; }
        public string TypeName { get; }
        public int ColumnSize { get; }
        public string BaseColumnName { get; }
        public bool IsReadOnly { get; }
        public bool IsAliased { get; internal set; }
        public int NumericPrecision { get; }
        public int NumericScale { get; }
        public bool IsUnique { get; internal set; }
        internal bool IsNotInWhere { get; set; }
    }
}
